import game.GameState;
import breakthrough.*;

public class TestController {

	public static void main(String[] args)
	{
		
		Heuristic c = new Heuristic();	
		
		GLaDOSBreakthroughPlayer p = new GLaDOSBreakthroughPlayer("Player",c);
		GreedyBreakthroughPlayer p2 = new GreedyBreakthroughPlayer("Player2");
		
		BreakthroughState brd = new BreakthroughState();
		
		long time = System.currentTimeMillis();

		int i = 0;
		while (brd.status == GameState.Status.GAME_ON)
//		for ( i = 4 ; i < 7 ; i++)
		{
//			p.DEPTH = i;
			long moveStart = System.currentTimeMillis();
			BreakthroughMove alpha;
			if (i % 2 == 0) {alpha = (BreakthroughMove) p.getMove(brd,""); System.out.println("GLaDOS moves");}
			else { alpha = (BreakthroughMove) p2.getMove(brd, "");System.out.println("GLaDOS moves");}
			brd.makeMove(alpha);
			System.out.println(brd);
			System.out.println("Move time = " + (System.currentTimeMillis() - moveStart)/1000.0 + " seconds. " + (i%2==0?"GLaDOS moved":"Greedy moved") );
			i++;
//			int x = 0;
		}
		
		System.out.println(brd.toString());
		System.out.println((System.currentTimeMillis() - time)/1000.0 + " seconds");

		System.out.println(i + " moves performed");
//		System.out.println(brd2);
//		time = System.currentTimeMillis();
//
//		BreakthroughMove alpha2 = (BreakthroughMove) p2.getMove(brd2, "");
//		brd2.makeMove(alpha2);
//		System.out.println(brd2.toString());
//		System.out.println((System.currentTimeMillis() - time)/1000.0 + " seconds");
//
//		System.out.println("Minimax done");
	}
}
